extends Item
var ctrl = globalData.infoDs["g_AneHek"]
var v = [Vector2(1,1),Vector2(1,0),Vector2(1,-1),Vector2(0,1),Vector2(0,-1),Vector2(-1,1),Vector2(-1,-1),Vector2(-1,0)]
func init():
	type = config.EQUITYPE_EQUI
	attInit()
	att.maxHp = 300
	att.def = 30
	att.mgiDef = 30
	name = "[color=yellow]战神鼓[/color]"
	info = "[color=red]<先手>每5秒为周围一格队友附加1层<增伤提升>[/color]"

var cnt = 0
var flag = 0

func _connect():
	masCha.connect("onBattleStart",self,"run")

func run():
	cnt = 0
	flag = 1
	addit(masCha.team)

func addit(team):
	var chas = getrcha(masCha.cell,team)
	if chas.size():
		for i in chas:
			i.addBuff(ctrl.b_zsts.new(1))

func _upS():
	._upS()
	if masCha.isDeath:return
	if !flag :
		flag = 1
		addit(masCha.team)

	if flag:
		cnt += 1
		if cnt % 5 == 0:
			flag = 0
			cnt = 0

func getrcha(cell,team):
	var chas = []
	for i in v:
		if !sys.main.isMatin(i+cell):continue
		var cha = sys.main.matCha(i + cell)
		if cha && cha.team == team:
			chas.append(cha)
	return chas
